package com.tianji.learning.controller;

import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.QuestionAdminPageQuery;
import com.tianji.learning.domain.dto.ReplyPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/replies")
@RequiredArgsConstructor
public class InteractionReplyAdminController {

    private final IInteractionReplyService replyService;

    /**
     * 管理端分页查询回答或评论
     * @param query
     * @return
     */
    @GetMapping("page")
    @ApiOperation("管理端分页查询回答或评论")
    public PageDTO<ReplyVO> queryAnswerPage(ReplyPageQuery query) {
        return replyService.queryAnswerPage(query);
    }

    /**
     * 显示或隐藏评论
     * @param id
     * @param hidden
     */
    @PutMapping("{id}/hidden/{hidden}")
    @ApiOperation("修改回答或评论的隐藏状态")
    public void updateHidden(@PathVariable Long id, @PathVariable Boolean hidden) {
        replyService.updateHidden(id, hidden);
    }
}
